// 适配器：将 OldPrinter 转换为 Printer 接口
public class PrinterAdapter implements Printer {
    private OldPrinter oldPrinter;

    public PrinterAdapter(OldPrinter oldPrinter) {
        this.oldPrinter = oldPrinter;
    }

    @Override
    public void print(String document) {
        // 调用适配者的方法，将请求传递给 OldPrinter
        oldPrinter.printDocument(document);
    }
}
